package com.test.ad;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.plugin.platform.PlatformViewFactory;

/**
 * 广告视图工厂
 */
public class AdViewFactory extends PlatformViewFactory {
    /**
     * @param createArgsCodec the codec used to decode the args parameter of {@link #create}.
     */
    public AdViewFactory(@Nullable MessageCodec<Object> createArgsCodec) {
        super(createArgsCodec);
    }

    @NonNull
    @Override
    public PlatformView create(Context context, int viewId, @Nullable Object args) {
        // viewId是flutter创建的View唯一性id, 用在查找该视图，比如flutter更新视图，可以通过该id缓存该视图查询更新。
        return new InsertAdView(context, viewId, args);
    }
}
